import fetch from '@/utils/network/fetch'

// 分页获取列表内容
const getstudyPaper = (data, objc) => {
    data &&
        fetch('/api/exam_paper', {
            ...objc,
            method: 'post',
            data
        })
}

// 删除某一条列表
const removeonePaper = (lIds, objc) => {
    lIds &&
        fetch('/api/exam_paper/deletion', {
            ...objc,
            method: 'post',
            data: { lIds }
        })
}

// 创建任务
const createPaper = (data, objc) => {
    data &&
        fetch('/api/exam_paper', {
            data,
            method: 'put',
            ...objc
        })
}
// 根据ID 查询单个任务
const queryOnePaper = (lIds, objc) => {
    lIds &&
        fetch(`/api/exam_paper/${lIds}`, {
            method: 'get',
            ...objc
        })
}
// 根据试卷添加业务关系PUT
const addBusinessRelation = (data, objc) => {
    data && fetch(`/api/exam_paper/${data.id}/business_relation`, {
        data,
        method: 'put',
        ...objc
    })
}

// 根据ID更新单个任务
const updateOnePage = (data, objc) => {
    data && fetch(`/api/exam_paper/${data.id}`, {
        data,
        method: 'put',
        ...objc
    })
}

const saveExamPaperBusinessScores = (data, objc) => {
    data && fetch(`/api/exam_paper/business_scores`, {
        data,
        method: 'put',
        ...objc
    })
}

export default {
    getstudyPaper,
    removeonePaper,
    createPaper,
    queryOnePaper,
    addBusinessRelation,
    updateOnePage,
    saveExamPaperBusinessScores
}
